package com.prs.crm.dao.warning.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.HibernateCallback;

import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.dao.warning.WarnDao;
import com.prs.crm.domain.cdxh.cd_Product;
import com.prs.crm.domain.warning.Warn;

/**
 * @author JohnLan
 * @time：2012-11-21 
 * @version 1.0
 * 类说明
 */

public class WarnDaoImpl extends BaseDaoImpl<Warn> implements WarnDao {

	/**
	 * 查询
	 */
	public List<Warn> getWarnings() {
		return  (List<Warn>) this.getHibernateTemplate().execute(
				new HibernateCallback() {
					public Object doInHibernate(Session session)
							throws HibernateException {
						Criteria criteria = session.createCriteria(Warn.class);
						criteria.add(Restrictions.eq("warnstate","1"));	
						return criteria.list();
					}
				});
	}

}
